function all() {
    var p0 = document.getElementById("price0").innerHTML;
    var p1 = document.getElementById("price1").innerHTML;
    var jg0 = parseFloat(p0.substring(1));
    var jg1 = parseFloat(p1.substring(1));
  
    document.getElementById("totalPrice").innerHTML = "¥" + (jg0 + jg1);
  }
  
  function plus(index) {
    var danjia = parseFloat(document.getElementsByName("price")[index].value);
    var sum = parseInt(document.getElementsByName("amount")[index].value);
    document.getElementsByName("amount")[index].value = sum + 1;
    var money = danjia * 100 * sum / 100;
    document.getElementById("price" + index).innerHTML = "¥" + money;
    all();
  }
  function minus(index) {
    var dj = parseFloat(document.getElementsByName("price")[index].value);
    var sum = parseInt(document.getElementsByName("amount")[index].value);
    if (sum == 1) {
      alert("商品数量不能再减少了")
    } else {
      document.getElementsByName("amount")[index].value = sum - 1;
      var money = dj * 100 * sum / 100;
      document.getElementById("price" + index).innerHTML = "¥" + money;
      all();
    }
  }
 
  
